\(\int \cos ^2(c+d x) (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [42]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 15 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=C x+\frac {B \sin (c+d x)}{d} \]

[Out]

C*x+B*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.107, Rules used = {4132, 2717, 8} \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {B \sin (c+d x)}{d}+C x \]

[In]

Int[Cos[c + d*x]^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

C*x + (B*Sin[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 4132

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rubi steps \begin{align*} \text {integral}& = B \int \cos (c+d x) \, dx+\int C \, dx \\ & = C x+\frac {B \sin (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.73 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=C x+\frac {B \cos (d x) \sin (c)}{d}+\frac {B \cos (c) \sin (d x)}{d} \]

[In]

Integrate[Cos[c + d*x]^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

C*x + (B*Cos[d*x]*Sin[c])/d + (B*Cos[c]*Sin[d*x])/d

Maple [A] (verified)

Time = 0.12 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07

method result size
risch \(C x +\frac {B \sin \left (d x +c \right )}{d}\) \(16\)
parallelrisch \(\frac {d x C +B \sin \left (d x +c \right )}{d}\) \(18\)
derivativedivides \(\frac {B \sin \left (d x +c \right )+C \left (d x +c \right )}{d}\) \(21\)
default \(\frac {B \sin \left (d x +c \right )+C \left (d x +c \right )}{d}\) \(21\)
norman \(\frac {C x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+C x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}-C x -\frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-C x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}\) \(112\)

[In]

int(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

C*x+B*sin(d*x+c)/d

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {C d x + B \sin \left (d x + c\right )}{d} \]

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

(C*d*x + B*sin(d*x + c))/d

Sympy [F]

\[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \left (B + C \sec {\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)**2*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Integral((B + C*sec(c + d*x))*cos(c + d*x)**2*sec(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.33 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (d x + c\right )} C + B \sin \left (d x + c\right )}{d} \]

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

((d*x + c)*C + B*sin(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (15) = 30\).

Time = 0.28 (sec) , antiderivative size = 39, normalized size of antiderivative = 2.60 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (d x + c\right )} C + \frac {2 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1}}{d} \]

[In]

integrate(cos(d*x+c)^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

((d*x + c)*C + 2*B*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 15.42 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \cos ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {B\,\sin \left (c+d\,x\right )+C\,d\,x}{d} \]

[In]

int(cos(c + d*x)^2*(B/cos(c + d*x) + C/cos(c + d*x)^2),x)

[Out]

(B*sin(c + d*x) + C*d*x)/d